<template>
  <div>
    <el-table :data="tableData" stripe style="width: 100%" size="small">
      <el-table-column align="center" label="序号" width="80">
        <template v-slot="scope">
          {{ (pageInfo.page - 1) * 10 + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column prop="visitorName" label="访客姓名" />
      <el-table-column prop="receptionistName" label="被访者姓名" />
      <el-table-column prop="visitStartDate" label="开始时间" width="150" />
      <el-table-column prop="visitEndDate" label="结束时间" width="150" />
    </el-table>
    <el-pagination
      size="small"
      background
      layout="prev, pager, next,total"
      :total="total"
      @current-change="handleCurrentChange"
    />
  </div>
</template>
<script>
import sppApi from '@/api/spp'
import { dayjs } from 'element-plus'

export default {
  name: 'VisitingList',
  props: {
    userType: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      tableData: [],
      total: 0,
      pageInfo: {
        page: 1,
        userType: 0,
        regdoorSta: 0,
        dayParam: dayjs().format('YYYY-MM-DD')
      },
      dialogTableVisible: false,
      userId: '',
      eventDate: '',
      dialogTitle: '人员轨迹信息'
    }
  },
  mounted() {
    this.initLoadData()
  },
  methods: {
    initLoadData() {
      sppApi.getVisitingList().then((res) => {
        if (res.code === 200) {
          this.tableData = res.data.records
          this.total = res.data.total
        }
      })
    }
  }
}
</script>
